﻿//-------------------------------------------------------------------
//	Copyright (c) 2010-2014  Zhirnov Andrey
//	This file is part of the "UX Standard Lib" project.
//	See copyright notice in "UX_STL_Core.h".
//-------------------------------------------------------------------

#include "../ux_stl_core.h"

#include "../Defines/PublicMacro.h"
#include "../CompileTime/CompileTimeChecks.h"
#include "../Math/Rand/Random.h"

namespace UX_STL
{
namespace UXTypes
{
	
/*
=================================================
	__InitializeAllRandomGenerators_Op
=================================================
*/
	struct __InitializeAllRandomGenerators_Op
	{
		usize result;

		__InitializeAllRandomGenerators_Op () : result(0)
		{}

		template <typename T, usize Index>
		void Process ()
		{
			result += (uint) UXMath::TRandomGenerator<T>::Initialize();
		}
	};

/*
=================================================
	__InitializeAllRandomGenerators
=================================================
*/
	static bool __InitializeAllRandomGenerators ()
	{
		typedef CompileTime::TypeList10< UXMath::DefaultRandomEngine, UXMath::PlatformRandomEngine >::type	engine_list;

		__InitializeAllRandomGenerators_Op	op;
		engine_list::ForEach( op );

		return op.result & 1;
	}

	static bool	__random_initialization__							= __InitializeAllRandomGenerators();
	

	// string //
	uint		CoreTypesConfig::StringDefaultRadix					= 10;
	uint		CoreTypesConfig::StringResizingMinSize				= 8;
	uint		CoreTypesConfig::StringResizingNominator			= 1;
	uint		CoreTypesConfig::StringResizingDenominator			= 2;

	// array //
	uint		CoreTypesConfig::ArrayResizingMinSize				= 8;
	uint		CoreTypesConfig::ArrayResizingNominator				= 1;
	uint		CoreTypesConfig::ArrayResizingDenominator			= 2;

	// queue //
	uint		CoreTypesConfig::QueueResizingMinSize				= 8;
	uint		CoreTypesConfig::QueueResizingNominator				= 1;
	uint		CoreTypesConfig::QueueResizingDenominator			= 2;

	// circular queue //
	uint		CoreTypesConfig::CircularQueueResizingMinSize		= 8;
	uint		CoreTypesConfig::CircularQueueResizingNominator		= 1;
	uint		CoreTypesConfig::CircularQueueResizingDenominator	= 2;
	
DEBUG_ONLY(
	// buffered ptr //
	uint		CoreTypesStatistic::BufferedPtrMaxBufferSize		= 0;
)

	Mutex				Singleton::_sCS;
	
DEBUG_ONLY(
	//atomic_int32		CReferenced::_s_uDebugCounter(0);

	set<CReferenced*>	CReferenced::_s_aObjects;
	Mutex				CReferenced::_s_sCSLockObjects;
)

}	// UXTypes
}	// UX_STL